<?
if( !function_exists("delEmail") ) { //Så att funktioner inte deklarerars flera gånger vid mass-skapande
        function delEmail($conn,$alias) {
                $delete = "cn=$alias,ou=Aliases,".$GLOBALS["dc"];
                ldap_delete($conn,$delete);
        }

        function addEmail($conn,$alias) {
                $add["cn"] = $alias;
                $add["objectClass"] = "nisMailAlias";
                $add["rfc822MailMember"] = $_POST["cn"];
                $dn = "cn=$alias,ou=Aliases,".$GLOBALS["dc"];
                ldap_add($conn,$dn,$add);
        }
}

if (isset($_GET["delEmail"]) AND $_GET["delEmail"])
	delEmail($conn,$_GET["delEmail"]);
if (isset($_POST["addEmail"]) AND $_POST["addEmail"])
	addEmail($conn,$_POST["addEmail"]);
?>
